import { ProductFileItem } from "../pis/models";
import { OrderItem } from "./models";
import req from "/@/api/req";

export const Api = {
  memberLevelList: "mall-ums/api/v1/member/member-levels/list",
  memberLevel: "mall-ums/api/v1/member/member-levels",

  batchRatio: "mall-ums/api/v1/pis/product-files/subscription-ratio",

  storeValuePage: "mall-ums/api/v1/member/stored-values/page",
  importStoreValue: "mall-ums/api/v1/member/stored-values/import",
  togggleFreeze: "mall-ums/api/v1/member/stored-values/freeze",

  orderPage: "mall-ums/api/v1/goods-orders/page",
  orderDetail: "mall-ums/api/v1/goods-orders/detail",
};

export function updateBatchRatio(productTypeId: number, pointRedemptionRatio: number) {
  return req.put({
    url: Api.batchRatio,
    data: {
      productTypeId,
      pointRedemptionRatio,
    },
  });
}

export function togggleFreeze(id) {
  return req.put(
    {
      url: Api.togggleFreeze,
      data: { id },
    },
    {
      useGlobalLoading: true,
    }
  );
}

export function getOrderDetail(orderNo) {
  return req.commonGet<ProductFileItem[]>(
    Api.orderDetail,
    { orderNo },
    {
      useGlobalLoading: true,
    }
  );
}
